// 1.yarn add classnames 添加库
// 2.导入classNames 函数
import React, { PureComponent } from 'react';
import classNames from 'classnames'
class App extends PureComponent {
  constructor(props) {
    super(props)
    this.state = {
      isActive: true,
      errClass: 'error',
      warnClass: undefined,
      warnClass1: 0
    }
  }
  render() {
    const {isActive,errClass,warnClass,warnClass1} = this.state
    return (
      // classNames()值为false或者undefined 都不显示
      <div>
        <h2 className={classNames("foo bar active title")}>我是标题一</h2>
        <h2 className={classNames({"active": isActive})}>我是标题二</h2>
        <h2 className={classNames(errClass, warnClass,warnClass1)}>我是标题二</h2>
      </div>
    );
  }
}


export default App;